package com.mercury.ec.framework.air.core.client.impl.sunstn.dto.pat;

import cn.hutool.core.util.StrUtil;
import com.mercury.ec.framework.air.core.client.impl.sunstn.dto.SunstnCommonReqDTO;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;

/**
 * PAT Request DTO
 *
 * @author hesx
 */
@Data
@NoArgsConstructor
public class SunstnPatReqDTO extends SunstnCommonReqDTO {
    /**
     * pnr
     */
    @NotBlank(message = "pnr不能为空")
    private String pnr;

    /**
     * 0:只返回最低的运价 1:返回所有的运价列表
     */
    private Integer allprice;

    /**
     * 用户自定义执行 PAT 时的指令行，例如 PAT:A*YD
     */
    private String pat_cmd;

    /**
     * 获取运价时，如果是以大客户编码方式获取，则需指令该大客户编码，如大客户编码为12345678，则系统在获取运价时，会执行指令：PAT:A#C12345678
     */
    private String customer_code = "";

    public SunstnPatReqDTO(String pnr, boolean allprice, String patCmd, String customerCode) {
        this.pnr = pnr;
        this.allprice = allprice ? 1 : 0;
        this.pat_cmd = patCmd;
        // 防止接口报错，未传值默认空串
        if (StrUtil.isNotBlank(customerCode)) {
            this.customer_code = customerCode;
        }
    }

    @Override
    public String getCmd() {
        return "PAT";
    }
}
